<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ taglib prefix="s" uri="/struts-tags" %>

<!DOCTYPE html "-//W3C//DTD XHTML 1.0 Strict//EN" 
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>home 地图 </title>
   
        <script type="text/javascript" src="http://www.google.com/jsapi?key=ABQIAAAAsnD6g25AONVvr5_uQnxNMhT2yXp_ZAY8_ufC3CFXhHIE1NvwkxR2cLQuGnOrK47JDGlIBIlcD_w_jA"></script>

        <script type="text/javascript">
          google.load("maps", "2");

          function initialize() {
            var map = new google.maps.Map2(document.getElementById("map_canvas"));
            var center = new google.maps.LatLng(${user.lat},${user.lng});
            map.setCenter(center, 14);
            map.addControl(new GLargeMapControl());
            var currentMaker = new GMarker(center, {draggable: true});
            map.addOverlay(currentMaker);
            google.maps.Event.addListener(map, "click", function(marker, point) {
                document.getElementById("lat").value = point.y;
                document.getElementById("lng").value = point.x;
                currentMaker.setPoint(point);
            });
            GEvent.addListener(currentMaker, "dragend", function() {
                document.getElementById("lat").value = currentMaker.getPoint().y;
                document.getElementById("lng").value = currentMaker.getPoint().x;
            });
          }
          google.setOnLoadCallback(initialize);
        </script>

  </head>
  <body  onunload="GUnload()">
    <h2>${user.username} Home Page</h2>
	
	
	
	Status:${user.status } 
	<br>
	<br>
	
	<s:if test="req==null">
	<s:if test="f==null">
		
		<s:form method="post" action="addFriend" namespace="/">
			<s:hidden name="username" value="%{user.username}"></s:hidden>
			<s:textarea label="Message" name="message" cols="50"></s:textarea>
			<s:submit value="Add To Friend"></s:submit>
		</s:form>
	</s:if>
	<s:else>
	${user.username}is you friend!!
	</s:else>
	</s:if>
	<s:else>
		You have sent message yet to ${user.username}.
	</s:else>
	
    
    <div id="map_canvas" style="width: 500px; height: 300px ;border:1px solid red;"></div>
  	
  	
	
  
  </body>
  
  
</html>


